<template>
	<view class="container">
		<TopBtn :title="'患者详情'"></TopBtn>
		<view class="listBox">
			<view class="list">
				<view class="">
					<view class="title flex-center b_B_e">
						<image :src="data.avatar" mode=""></image>
						<view class="">
							<view class="name">
								{{data.name}} <text>{{data.age}}岁</text> <text>{{data.patientSex==1?'男':'女'}}</text> <text
									class="disease">胃溃疡</text>
							</view>
							<view class="flex-center frequency">
								<view>
									问诊次数：<text>{{data.numberOfConsult||0}}次</text>
								</view>
								<view>
									开方次数：<text>{{data.numberOfOpen||0}}次</text>
								</view>
							</view>
						</view>
					</view>
					<view class="btmBox flex-sp-center">
						<view class="">
							<image src="@/static/ConsultationRoom/rq.png" mode=""></image> <uni-dateformat :date="data.createTime"
								format="yyyy-MM-dd hh:mm"></uni-dateformat>
						</view>
						<view class="flex-center">
							<uni-icons type="right" size="16" color="#999"></uni-icons>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="nav">
			<z-tabs ref="tabs" bgColor="#00000000" :list="tabList" :current="current" @change="tabsChange" />
		</view>
		<PatientCondition v-if="current==0" :data="data.medicalRecordRespVOS"></PatientCondition>
		<PatientConsultation v-if="current==1" :data="data.outpatientInfoRespVO"></PatientConsultation>
		<PatientPrescription v-if="current==2" :data="data.prescriptionInfoRespVO"></PatientPrescription>
		<PatientReservation v-if="current==3" :data="data.appointInfoRespVO"></PatientReservation>
	</view>
</template>

<script>
	import {
		getPatientInfo
	} from '@/api/user'
	export default {
		data() {
			return {
				current: 0,
				tabList: ['病历记录', '问诊记录', '处方记录', '预约记录'],
				data: {
					appointInfoRespVO: [],
					medicalRecordRespVOS: [],
					outpatientInfoRespVO: [],
					prescriptionInfoRespVO: [],
				}
			};
		},
		onLoad(e) {
			this.getPatientInfo(e.id)
		},
		methods: {
			getPatientInfo(e) {
				getPatientInfo({
					id: e
				}).then(res => {
					this.data = res.data
				})
			},
			tabsChange(index) {
				this.current = index;
			},
			goinfo(id) {
				if (id) {
					uni.navigateTo({
						url: `/pages/prescription/details/details?id=${id}`,
					})
				}
			},
		}
	}
</script>

<style lang="less" scoped>
	.state {
		width: 86rpx;
		height: 33rpx;
		border-radius: 10rpx;
		border: 1px solid #3E6EFE;
		font-weight: 500;
		font-size: 22rpx;
		margin-left: 15rpx;
		color: #3E6EFE !important;
	}


	.b_B_e {
		padding-bottom: 20rpx;
		border-bottom: 1px solid #EEEEEE;
	}


	.listBox {
		margin-top: 43rpx;
		padding: 0 30rpx;

		.list {
			width: 690rpx;
			min-height: 182rpx;
			background: #FFFFFF;
			border-radius: 30rpx;
			padding: 20rpx;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-around;
			margin-bottom: 30rpx;

			&>view {
				width: 100%;
			}

			.btmBox {
				margin-top: 25rpx;
				font-weight: 500;
				font-size: 26rpx;
				color: #999999;

				image {
					width: 25rpx;
					height: 25rpx;
					margin-right: 16rpx;
				}
			}

			.title {
				.name {
					font-weight: bold;
					font-size: 32rpx;
					color: #333333;

					text {
						font-weight: 500;
						font-size: 26rpx;
						color: #333;
						margin-left: 19rpx;
					}

					.disease {
						display: inline-block;
						width: 125rpx;
						height: 44rpx;
						background: #FFFFFF;
						border-radius: 26rpx;
						border: 1px solid #F1AE34;
						text-align: center;
						line-height: 44rpx;
						font-weight: 500;
						font-size: 28rpx;
						color: #F1AE34;
						margin-bottom: 10rpx;
					}
				}

				image {
					width: 91rpx;
					height: 91rpx;
					border-radius: 50%;
					margin-right: 30rpx;
				}

				.frequency {
					font-weight: 500;
					font-size: 26rpx;
					color: #999999;

					&>view {
						margin-right: 44rpx;

						text {
							color: #3C6DFE;
							font-size: 30rpx
						}
					}

				}
			}






		}

		.typeBox {
			margin-top: 15rpx;
			font-weight: 500;
			font-size: 28rpx;

			&>view {
				color: #333;

				&>view {
					color: #999;
				}
			}

			text {
				display: inline-block;
				min-width: 63rpx;
				height: 33rpx;
				background: #DEF7ED;
				border-radius: 10rpx;
				font-weight: 500;
				font-size: 22rpx;
				color: #23CC88;
				text-align: center;
				line-height: 33rpx;
				margin: 0 10rpx;

			}

			.HospitalType {
				display: inline-block;
				min-width: 63rpx;
				height: 33rpx;
				background: #FDF3E1;
				border-radius: 10rpx;
				font-weight: 500;
				font-size: 22rpx;
				color: #F1AE34;
				text-align: center;
				padding: 0 8rpx;
				line-height: 33rpx;
				margin: 0 10rpx;
			}

		}
	}
</style>